package com.film.admincontroller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.domain.FilmOrder;
import com.film.domain.UserOrder;
import com.film.service.OrderService;
import com.film.service.impl.OrderServiceImpl;

@WebServlet("/adminUserOrder.do")
public class SelectUserOrderAdminController extends HttpServlet{
	public OrderService orderService = new OrderServiceImpl();
	@Override
	
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		List<FilmOrder> AllOrders = orderService.selectAllOrder();
		List<UserOrder> orders = orderService.arrangeList(AllOrders);
		HttpSession session = req.getSession();
		session.setAttribute("orders", orders);
		resp.sendRedirect("/film/admin_jsp/userOrder.jsp");
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req, resp);
	}
	
}
